package com.ushine.web.component.design.chain.salary.handler;

import com.ushine.web.component.design.chain.salary.config.AbstractSalaryCalculateHandler;
import com.ushine.web.component.design.chain.salary.model.SalaryCalculateBO;
import com.ushine.web.component.design.strategy.SalaryStrategyClient;
import com.ushine.web.component.exception.ServiceException;
import com.ushine.web.component.http.HttpResponseVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: yls
 * @Date: 2022/03/04 10:36
 * @Description: 计算薪资的具体细节
 * @Version 1.0
 */
@Service
public class SalaryDetailsHandler extends AbstractSalaryCalculateHandler {

    @Resource
    private SalaryStrategyClient salaryStrategyClient;

    @Override
    protected HttpResponseVO<?> process(SalaryCalculateBO salaryCalculate) throws ServiceException {
        /*
         * 可以根据薪资计算的具体业务来拆分，
         * 如果细节计算过于复杂、可以按照类别拆分为多个细节计算
         * 增值税
         * 绩效
         * 基本薪资
         */
        salaryStrategyClient.getSalaryCalculateByType(salaryCalculate);
        return new HttpResponseVO<>().ok("薪资计算的细节计算完成！",salaryCalculate);
    }
}
